USER_INFO_REPORT = {
    'dynamic_argument': False,
    'real_time_report': True,
    'target_event_id': ['recharge', 'bet_order', 'withdraw', 'active'],
    'values': [
        {
            "value_id": "recharge_amount",
            "target_value": "recharge_price",
            "value_name": "充值金额",
            "filter": [
                {'term': {'_event_id': 'recharge'}},
            ],
        },
        {
            "value_id": "recharge_count",
            "target_value": "_user_id",
            "value_name": "充值次数",
            "filter": [
                {'term': {'_event_id': 'recharge'}},
            ],
            "operation": "value_count",
            "value_type": "long"
        },
        {
            "value_id": "last_recharge_at",
            "target_value": "_event_time",
            "value_name": "最后充值时间",
            "filter": [
                {'term': {'_event_id': 'recharge'}}
            ],
            "operation": "max",
        },
        {
            "value_id": "withdraw_amount",
            "target_value": "withdraw_real_price",
            "value_name": "提现金额",
            "filter": [
                {'term': {'_event_id': 'withdraw'}},
            ],
        },
        {
            "value_id": "withdraw_count",
            "target_value": "withdraw_price",
            "value_name": "提现次数",
            "filter": [
                {'term': {'_event_id': 'withdraw'}},
            ],
            "operation": "value_count",
            "value_type": "long"
        },
        {
            "value_id": "tax_amount",
            "target_value": "bet_order_tax_amount",
            "value_name": "税收金额",
            "filter": [
                {'term': {'_event_id': 'bet_order'}},
            ],
        },
        {
            "value_id": "active_days",
            "target_value": "_event_time",
            "value_name": "活跃天数",
            "filter": [
                {'term': {'_event_id': 'bet_order'}}
            ],
            "operation": "histogram",
            "histogram": {
                "interval": 86400,
                "min_doc_count": 1,
                "extended_bounds": True
            },
        },
        {
            "value_id": "gain_amount",
            "target_value": ["bet_order_bet_amount", '-', "bet_order_award_amount"],
            "value_name": "营收金额",
            "filter": [
                {'terms': {'_event_id': ['bet_order']}},
            ],
            "value_type": "float",
        },
        {
            "value_id": "win_amount",
            "value_name": "总盈亏",
            "value_expr": "gain_amount - tax_amount",
        },
        {
            "value_id": "back_at",
            "target_value": "_event_time",
            "value_name": "召回时间",
            "filter": [
                {'term': {'_event_id': 'active'}}
            ],
            "operation": "min",
        },
    ]
}
